package org.jpropelleralt.node;

import java.awt.Color;

import org.jpropelleralt.path.PathStep;
import org.jpropelleralt.ref.Ref;

/**
 * A {@link Node} having a color {@link Ref}
 * with a {@link Color} value.
 */
public interface Colored extends Node {
	
	/**
	 * Get the {@link Color} of this {@link Node}
	 * Note that the {@link Ref} returned from this
	 * method must have the ref-name "color" in
	 * this {@link Node}.
	 * @return	{@link Node}'s {@link Color}, as a {@link Ref}
	 */
	public Ref<Color> color();
	
	/**
	 * The ref-name used within {@link Colored} nodes to
	 * refer to their color property.
	 */
	public final static String NAME = "color";
	
	/**
	 * {@link PathStep} from a {@link Colored} to its
	 * {@link Colored#color()} {@link Ref}.
	 */
	PathStep<Colored, Color> toColor = new PathStep<Colored, Color>() {
		public Ref<Color> transform(Colored s) {
			return s.color();
		};
	};
}
